{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": true,
    "pycharm": {
     "is_executing": false
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "text": [
      "Input:  D:\\CloudSpace\\WorkSpace\\PatholNLP//data//original_txt\\病理诊断-10.txt \n",
      " D:\\CloudSpace\\WorkSpace\\PatholNLP//data//original_txt\\病理诊断-10.txtoriginal.txt\n",
      "(右乳)囊性增生病。$(左乳)腺纤维瘤。\n",
      "[('B右乳', 'B', 0, 0), ('D囊性增生病', 'D', 0, 0), ('B左乳', 'B', 1, 0), ('D腺纤维瘤', 'D', 1, 0)]\n",
      "6\n",
      "number of nodes:  6 , number of dges:  5\n"
     ],
     "output_type": "stream"
    },
    {
     "data": {
      "text/plain": "<Figure size 432x288 with 1 Axes>",
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAb4AAAEuCAYAAADx63eqAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjAsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+17YcXAAAgAElEQVR4nO3deXyM997/8ddMZiQItW85NBp7Yhe0qFiqh6aUw6nW0hZHbb21pY6dX1utHlRrq6oeWrnpKUpt5XSxt6HWCkLF0kokQpqQPZO5fn9clVtqVzKZyfv5eHgkuebKzOealvd8v9d3sRiGYSAiIlJAWF1dgIiISF5S8ImISIGi4BMRkQJFwSciIgWKgk9ERAoUBZ+IiBQoCj4RESlQFHwiIlKgKPhERKRAUfCJiEiBouATEZECRcEnIiIFioJPREQKFAWfiIjcExcvXsThcLi6jFtS8ImIyDWysrJy/fzFF1+wcOHCnJ8NwyA1NTXXOR06dCAqKirXsTfeeIOpU6fe8vXOnDnD4cOHc35evnw5GRkZuc45ePAgTqcTgNGjRzNx4sTbu5g/UPCJiBRgkydPxtfXlxIlStCmTRsiIiIAGDFiBCEhITl/Jk2axPTp03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7IvInKfjEJRwOx9394n2YynDs2DGio6Pv6XOKSP6l4JP7KiMjg+TkZJKTk0lPT885/te//pWIiIjr/s6MGTNYv379NcdTUlL4z5dfEm6z5RzLzs5m8ODBXLx4EYBdu3YxZMgQ4uLimDhx4nWf/8CBA6xevTrnz6hRoxg3blzOzytWrODw4cN/5rJFJB+z3foUkVubPHky06dPx2az0bBhQ2bPnk1QUBAvvvgiJ06cwMvLi0qVKvHCCy/w+uuvc+DAAQYNGgRAp06dGDt2LABZWVnMnz+f7777DoDVq1fz7bffsn//fvbv30+jMmV4vGpVmv/+ups2beLs2bOULl065/wqVapQrlw59u3bx6VLlyhevHiuWhctWkRMTAwtWrTg4sWL+Pr60qBBA06fPg1AWloaZcqUuf9vmoi4hFp8cs8MGzaM+Ph42rZtS6dOncjIyMDb25s333yTd955h0KFCpGYmEhISAjJycns2LGDN998kzNnzuQ8x4IFC+jTpw/lypUjNDQUwzBo3rw5M2fOpGzZsmzv2JHxf/97zvkffvghEydOZN68efz0008sWbKEZcuW0bJlS86dO0eHDh1o3bo1AMePH+e7777D19eXxx57jE2bNnHgwAFatWpFdHQ0K1asYMWKFURFRRESEpLXb5+I5BG1+OSestvtTJgwgUWLFrF582YsV20dZLFYsFqtLFy4kHXr1gGQnJxM+/btAdi9ezfvvfce69atY8aMGdSpU4euXbsCkJiYCED8ycucrhaIfzzs3buR06dPk5iYyLvvvktmZibR0dHs2LEDHx8fevbsyZYtW3Je32q1MmjQIFq3bk3VqlVJSEhg1apVHDp0iH79+tGwYUM2btzI888/nzdvloi4hIJP7ov69esTGRkJwEsvvYTVaqVhw4Y4HA66dOnCSy+9BMCPP/7I999/D8CJEyfw9/dnzJgxRERE8NNPP+V6zpQUePCbjyn0vY3MifDKK3Y6duzI2LFjGTp0KB999BFNmzalR48eWK1WIiMjad68OU8++STjxo2jWrVq7Nq1ixkzZmC1WjEMgyVLljBjxgzWrl1LmTJlsFgsucJaRDyPgk/uC19fX5KTkwGYPXs2Pj4+zJ8/n2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5YmNjadCgAbGxsTnHEhMT+eWXX6hXr17OsZCQEBYvXoy/v/91a+rQoQOjRo2iffv2lC1blpo1a+Z6/LfffqNjx45Mnz793rwJIpLvKPjkvrr6f68r0wSys7M5efKkSwaRXJlUD+YAnKJFi+Z5DSLiWgo+EREpUDSqU0REChQFn4iIFCgKPhERKVAUfCIiUqAo+EREpEBR8ImISIGi4BMRkQJFwSciIgWKgk9ERAoUBZ+IiBQoCj4RESlQFHwiIlKgKPhERKRAUfCJiEiB8v8BJNUQYEv6ln4AAAAASUVORK5CYII=\n"
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "#!/usr/bin/env python\n",
    "# -*- coding: utf-8 -*-\n",
    "\"\"\"\n",
    "__author__ = 'Justin'\n",
    "__mtime__ = '2019-12-10'\n",
    "\n",
    "\"\"\"\n",
    "\n",
    "import unittest\n",
    "from tag_reader import Tag_Reader\n",
    "import matplotlib.pyplot as plt\n",
    "import networkx as nx\n",
    "\n",
    "# 进行子图的输出\n",
    "tr = Tag_Reader()\n",
    "record_id = 10\n",
    "original_txt, record = tr.loading_single_instance(\"original_txt\",\"病理诊断-{}.txt\".format(record_id))\n",
    "\n",
    "print(original_txt)\n",
    "print(record)\n",
    "dict_entity_code = tr.initialize_dictionary([record])\n",
    "print(len(dict_entity_code))\n",
    "\n",
    "G = tr.create_single_instance_graph(record_id, record, dict_entity_code)\n",
    "print(\"number of nodes: \", G.number_of_nodes(), \", number of dges: \", G.number_of_edges())\n",
    "\n",
    "# pos 指的是布局 主要有spring_layout , random_layout,circle_layout,shell_layout。circular_layout\n",
    "nx.draw(G,pos = nx.spring_layout(G),node_color = 'b',edge_color = 'r',\n",
    "        labels=dict_entity_code.inverse,\n",
    "        with_labels = True,font_size =12,node_size =20)\n",
    "\n",
    "plt.rcParams['font.family'] = ['sans-serif']\n",
    "plt.rcParams['font.sans-serif'] = ['SimHei']\n",
    "# plt.show(left=0.2, right=0.8, top=0.8, bottom=0.2)\n",
    "plt.show()"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  },
  "pycharm": {
   "stem_cell": {
    "cell_type": "raw",
    "source": [],
    "metadata": {
     "collapsed": false
    }
   }
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}